package de.slothsoft.commons;

public class Option {

	public static Option createStringOption(String name, String key,
			String defaultValue) {
		return createOption(ValueType.STRING, name, key, defaultValue);
	}

	public static Option createMultilineStringOption(String name, String key,
			String defaultValue) {
		return createOption(ValueType.MULTI_LINE_STRING, name, key,
				defaultValue);
	}

	public static Option createIntegerOption(String name, String key,
			int defaultValue) {
		return createOption(ValueType.INTEGER, name, key,
				Integer.valueOf(defaultValue));
	}

	public static Option createBooleanOption(String name, String key,
			boolean defaultValue) {
		return createOption(ValueType.BOOLEAN, name, key,
				Boolean.valueOf(defaultValue));
	}

	public static Option createOption(ValueType type, String name, String key,
			Object defaultValue) {
		return new Option(type, name, key, defaultValue);
	}

	private String key;
	private String name;
	private Object defaultValue;
	private ValueType valueType;
	private String description;

	public Option(ValueType valueType, String name, String key,
			Object defaultValue) {
		this.key = key;
		this.name = name;
		this.defaultValue = defaultValue;
		this.valueType = valueType;
	}

	public String getKey() {
		return this.key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Object getDefaultValue() {
		return this.defaultValue;
	}

	public void setDefaultValue(Object defaultValue) {
		this.defaultValue = defaultValue;
	}

	public ValueType getValueType() {
		return this.valueType;
	}

	public void setValueType(ValueType valueType) {
		this.valueType = valueType;
	}

	/**
	 * Can be html...
	 * 
	 * @return
	 */

	public String getDescription() {
		return this.description;
	}

	/**
	 * Can be html...
	 * 
	 * @return
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * Type of value
	 */

	public static enum ValueType {
		STRING, MULTI_LINE_STRING, INTEGER, BOOLEAN;
	}

}
